package com.qijian.maindata.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qijian.common.annotation.Excel;
import com.qijian.common.core.domain.BaseEntity;
import com.qijian.common.enums.ApprovalDescriptionEnum;
import com.qijian.maindata.domain.vo.BomMaterialStorageVo;
import com.qijian.tool.domain.Storage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 生产BOM用料单据对象 main_bom_material
 *
 * @author qijian
 * @date 2022-05-16
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
@TableName("main_bom_material")
public class BomMaterial extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "ID")
    private Long id;

    @Excel(name = "编码")
    @ApiModelProperty(value = "编码")
    private String code;

    @Excel(name = "BOM")
    @ApiModelProperty(value = "BOM")
    private String bomId;

    @Excel(name = "BOM名称")
    @ApiModelProperty(value = "BOM名称")
    private String itemName;

    @Excel(name = "类型")
    @ApiModelProperty(value = "类型")
    private String itemType;

    @Excel(name = "开工令")
    @ApiModelProperty(value = "开工令组合")
    private String projectNos;

    @Excel(name = "发放人")
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "发放人")
    private Long grantId;

    @Excel(name = "发放人名称")
    @ApiModelProperty(value = "发放人名称")
    private String grantNickName;

    @Excel(name = "汇总")
    @ApiModelProperty(value = "汇总")
    private BigDecimal summary;

    @Excel(name = "状态(0-完成，1-编制中，2-编制完成)")
    @ApiModelProperty(value = "状态(0-完成，1-编制中，2-编制完成)")
    private Integer status;

    @Excel(name = "审核者")
    @ApiModelProperty(value = "审核者")
    private String approvalBy;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "审核时间")
    private Date approvalTime;

    @Excel(name = "审核状态")
    @ApiModelProperty(value = "审核状态")
    private ApprovalDescriptionEnum approvalStatus;

    @ApiModelProperty(value = "附件明细")
    @TableField(exist = false)
    private List<Storage> files;

    @ApiModelProperty(value = "物料明细")
    @TableField(exist = false)
    private List<BomMaterialDetail> details;

    @ApiModelProperty(value = "开工令明细")
    @TableField(exist = false)
    private List<BomMaterialProject> projects;

    @ApiModelProperty(value = "材料附件")
    @TableField(exist = false)
    private List<BomMaterialStorageVo> materialFileList;

    @ApiModelProperty(value = "仓库附件")
    @TableField(exist = false)
    private List<BomMaterialStorageVo> cageFileList;

    @ApiModelProperty(value = "采购附件")
    @TableField(exist = false)
    private List<BomMaterialStorageVo> cgFileList;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "计划出厂", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "计划出厂")
    private Date planRelease;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "计划完工时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "计划完工时间")
    private Date planProduceFinishDate;


    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "客户交期", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "客户交期")
    private Date planSign;

    private String bomMaterialType;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "采购计划到货时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "采购计划到货时间")
    private String purmPlanDate;

    @ApiModelProperty(value = "厂区")
    private String factoryName;

    private String projectManagerDept;

    private String projectManagerId;


    private String projectManager;

    private String warehouse;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long gyId;


    private String gyName;

    private String materialFrom;

    private String gyDec;

    private String extra;


    @TableField(exist = false)
    private String userId;

    @TableField(exist = false)
    private String taskId;

    @TableField(exist = false)
    private String processInstanceId;

    @TableField(exist = false)
    private String nodeName;

    @TableField(exist = false)
    private String taskNickName;

    private Long kingdeeId;

    private String kingdeeCode;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date submissionTime;

}
